package day07;

import java.util.Scanner;

public class CalAirPric {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入机票价格");
        int price=scanner.nextInt();//价格
        System.out.println("请输入月份");
        int month=scanner.nextInt();//月份
        System.out.println("请选择仓位，1.头等舱，2.商务车，3.经济舱");
        int type=scanner.nextInt();
        int finalPrice=calAirPrice(price,month,type);
        if (finalPrice>0){
        System.out.println("机票价格为"+finalPrice);
        }else {
            System.out.println("输入错误，请重新输入");
        }
    }
    public static int calAirPrice(int price,int month,int type){
        if (month<0||month>12||type<1||type>3||price<0){
            return -1;
        }
       if (month>5&&month<10){
           if (type==1){
               price*=0.9;
           }else if(type==2){
               price*=0.8;
           }else {
               price*=0.7;
           }
       }else {
           if (type==1){
               price*=0.85;
           }else if(type==2){
               price*=0.75;
           }else {
               price*=0.65;
           }
       }

        return price;
    }
}
